package com.party.mobile.web.dto.photo.output;

import com.party.core.model.photo.PhotosTag;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @Description: 分类输出
 * @Author: yangshoukun
 * @Date: 2018/6/5 14:54
 */
public class TagOutput implements Serializable {

    private static final long serialVersionUID = 8609169295349482127L;

    private String id;

    private String name;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TagOutput)) return false;

        TagOutput tagOutput = (TagOutput) o;

        if (id != null ? !id.equals(tagOutput.id) : tagOutput.id != null) return false;
        return name != null ? name.equals(tagOutput.name) : tagOutput.name == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "TagOutput{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                '}';
    }

    public static TagOutput transform(PhotosTag tag) {
        TagOutput output = new TagOutput();
        BeanUtils.copyProperties(tag, output);
        return output;
    }
}
